package com.production.CoursePlatform.service;

import com.production.CoursePlatform.entity.Attachment;
import com.production.CoursePlatform.mapper.AttachmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AttachmentService {

    @Autowired
    private AttachmentMapper attachmentMapper;

    public Attachment saveAttachment(Attachment attachment) {
        attachmentMapper.insertAttachment(attachment); // 插入数据并回填 aID
        return attachment; // 返回插入后的对象，包含生成的 aID
    }

    public Attachment getAttachmentById(int aID) {
        return attachmentMapper.selectAttachmentById(aID);
    }
}
